home *** CD-ROM | disk | FTP | other *** search
/ ADA Programming Guide / ADA Programming Guide.iso / ada_gnu / adainc / s-stoele.ads < prev    next >
Text File  |  1996-01-30  |  3KB  |  75 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                         GNAT COMPILER COMPONENTS                         --
  4. --                                                                          --
  5. --               S Y S T E M . S T O R A G E _ E L E M E N T S              --
  6. --                                                                          --
  7. --                                 S p e c                                  --
  8. --                                                                          --
  9. --                            $Revision: 1.16 $                             --
  10. --                                                                          --
  11. -- This specification is adapted from the Ada Reference Manual for use with --
  12. -- GNAT.  In accordance with the copyright of that document, you can freely --
  13. -- copy and modify this specification,  provided that if you redistribute a --
  14. -- modified version,  any changes that you have made are clearly indicated. --
  15. --                                                                          --
  16. ------------------------------------------------------------------------------
  17.  
  18. package System.Storage_Elements is
  19. pragma Pure (Storage_Elements);
  20. --  Note that we take advantage of the implementation permission to make
  21. --  this unit Pure instead of Preelaborable, see RM ???
  22.  
  23.    type Storage_Offset is range
  24.      -(2 ** (Standard'Address_Size - 1)) ..
  25.      +(2 ** (Standard'Address_Size - 1)) - 1;
  26.  
  27.    subtype Storage_Count is Storage_Offset range 0 .. Storage_Offset'Last;
  28.    subtype Storage_Index is Storage_Offset range 1 .. Storage_Offset'Last;
  29.  
  30.    type Storage_Element is mod 2 ** Storage_Unit;
  31.    for Storage_Element'Size use Storage_Unit;
  32.  
  33.    type Storage_Array is
  34.      array (Storage_Index range <>) of aliased Storage_Element;
  35.    for Storage_Array'Component_Size use Storage_Unit;
  36.  
  37.    --  Address arithmetic
  38.  
  39.    function "+" (Left : Address; Right : Storage_Offset) return Address;
  40.    pragma Convention (Intrinsic, "+");
  41.    pragma Inline ("+");
  42.  
  43.    function "+" (Left : Storage_Offset; Right : Address) return Address;
  44.    pragma Convention (Intrinsic, "+");
  45.    pragma Inline ("+");
  46.  
  47.    function "-" (Left : Address; Right : Storage_Offset) return Address;
  48.    pragma Convention (Intrinsic, "-");
  49.    pragma Inline ("-");
  50.  
  51.    function "-" (Left, Right : Address) return Storage_Offset;
  52.    pragma Convention (Intrinsic, "-");
  53.    pragma Inline ("-");
  54.  
  55.    function "mod"
  56.      (Left  : Address;
  57.       Right : Storage_Offset)
  58.       return  Storage_Offset;
  59.    pragma Convention (Intrinsic, "mod");
  60.    pragma Inline ("mod");
  61.  
  62.    --  Conversion to/from integers
  63.  
  64.    type Integer_Address is mod Memory_Size;
  65.  
  66.    function To_Address (Value : Integer_Address) return Address;
  67.    pragma Convention (Intrinsic, To_Address);
  68.    pragma Inline (To_Address);
  69.  
  70.    function To_Integer (Value : Address) return Integer_Address;
  71.    pragma Convention (Intrinsic, To_Integer);
  72.    pragma Inline (To_Integer);
  73.  
  74. end System.Storage_Elements;
  75.